Skip to content

修复读取图片时展示原始内容的问题 - #201

Merged
ji233-Sun merged 1 commit into
mainfrom
fix/192-tool-image-preview
Sep 22, 2026
Merged

ji233-Sun merged 1 commit into
mainfrom
fix/192-tool-image-preview

Conversation

@ji233-Sun

Copy link
Copy Markdown
Owner

读取图片后,桌面端原先会把工具返回的 Base64/JSON 展示为文件内容;较大的图片还会被 Runner 的 10,000 字符限制截断,导致无法解码。现在工具详情显示等比图片预览,支持放大、缩小,并按原顺序保留随附文字。

  • 识别 Claude、MCP、OMP/Pi 和 ACP 的图片内容块,以及本地图片读取和 Codex imageView。相对路径使用任务工作目录,读取失败保留原始错误。
  • OMP/Pi 保留混合文本和图片;ACP 优先保留含媒体的展示内容,避免原始摘要覆盖图片。Runner 保留媒体数据及 JSON 结构,随附文本仍受长度限制。
  • 复用已有 GPUI 图片组件、结果缓存和测试设施;损坏图片或不支持的格式显示提示,预览中不提供二进制文本复制控件。

验证:macOS 本地累计 417 项测试通过,1 项原有滚动性能测试按配置忽略。回归覆盖多种内容块格式、多图与文本顺序、大图传递、任务相对路径、错误保留,以及真实 PNG 解码和 GPUI 展开/缩放/收起交互。

以下命令全部通过:

cargo fmt --all -- --check
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo test -p nexus-runner -p nexus-harness-acp -p nexus-harness-omp -p nexus-harness-pi --locked
cargo test -p nexus-desktop -p nexus-harness-core -p nexus-harness-claude -p nexus-harness-codex --locked
cargo test -p nexus-harness-acp --locked
cargo build --workspace --locked
git diff --check

范围:本次实现桌面端图片预览;音频、视频和文档内容块显示暂不支持提示。Remote Web 未在本次修改;未进行真实模型调用和 Windows/Linux 实机验收。

Closes #192

@ji233-Sun
ji233-Sun merged commit 747ad96 into main Sep 22, 2026
3 checks passed
@ji233-Sun
ji233-Sun deleted the fix/192-tool-image-preview branch September 24, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

读取多媒体(比如图片)时应当展示预览,而非文件内容

1 participant